meson: Fix Vulkan dependency checking
authorNirbheek Chauhan <nirbheek@centricular.com>
Fri, 4 Sep 2020 06:02:35 +0000 (11:32 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Fri, 4 Sep 2020 06:20:50 +0000 (11:50 +0530)
The dependency block was completely wrong. It was:

1. Not searching for the lib manually when -Dvulkan=enabled (default).
   The else block was only hit when -Dvulkan=auto.
2. Unconditionally searching for the vulkan library in the else block
   when -Dvulkan=disabled

The manual searching is also not required because Meson has a custom
'vulkan' dependency class that already supports Windows, and is more
correct than the code here. Specifically, the current code does not
support picking up the Vulkan SDK from a custom path.

Fixes #3108

meson.build

index 5ad8508fb3506d54aceb54990695e3bcf05b7510..c520298a849ea02ccbfdf0166ed16ff6ae4f8f4d 100644 (file)
@@ -648,23 +648,16 @@ if os_unix
 endif
 
 # Check for Vulkan support
+# Uses meson's custom vulkan dependency searching. Set the VULKAN_SDK env var
+# to use a custom path for the Vulkan SDK. Bugs that are found with it should
+# be reported upstream and fixed.
 vulkan_dep = dependency('vulkan', required: get_option('vulkan'))
 if vulkan_dep.found()
   have_vulkan = true
-  vulkan_pkg_found = true
+  vulkan_pkg_found = vulkan_dep.type_name() == 'pkgconfig'
 else
   have_vulkan = false
   vulkan_pkg_found = false
-  if cc.get_id() == 'msvc'
-    vulkan_libname = 'vulkan-1'
-  else
-    vulkan_libname = 'vulkan'
-  endif
-  vulkan_dep = cc.find_library(vulkan_libname, required: false)
-  if vulkan_dep.found() and cc.has_function('vkCreateInstance', dependencies: vulkan_dep) and cc.has_header('vulkan/vulkan.h')
-    have_vulkan = true
-    pc_gdk_extra_libs += ['-l@0@'.format(vulkan_libname)]
-  endif
 endif
 
 cloudproviders_dep = dependency('cloudproviders',